import { PixelRatio } from 'react-native';

import { isIOS } from '../constant';
import { getIsOpenGuestEntry } from '../store/appConfig';
import { getScreenInfo } from './screen';

export const moneySymbol = (needSymbol = false): string => {
  const isOpenGuestEntry = getIsOpenGuestEntry();
  return isIOS && isOpenGuestEntry && !needSymbol ? '' : '¥';
};

export const empty = '';

export const getLaunchImage = (): string => {
  const { height } = getScreenInfo({});
  const launchHeight = height * PixelRatio.get();

  switch (launchHeight) {
    case 960: // iPhone4系列
      return 'LaunchImage-700@2x';
    case 1136: // iPhone5系列
      return 'LaunchImage-700-568h@2x';
    case 1334: // iPhone6系列
      return 'LaunchImage-800-667h@2x';
    case 2208: // iPhone6+系列
      return 'LaunchImage-800-Portrait-736h@3x';
    case 2436: // iPhoneX/iPhoneXs
      return 'LaunchImage-1100-Portrait-2436h@3x';
    case 1792: // iPHoneXr
      return 'LaunchImage-1200-Portrait-1792h@2x';
    case 2688: // iPhoneXs Max
      return 'LaunchImage-1200-Portrait-2688h@3x';
    default:
      return 'LaunchImage-Portrait~ipad';
  }
};
